<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('作业列表')" />
</head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								运行状态：<select name="status" style="width: 100px" th:with="type=${@dict.getType('job_run_status')}">
								<option value="">所有</option>
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "oozie/watchJob";
        var jobId = [[${jobId}]];

        $(function() {
            var options = {
                url: prefix + "/jobLog/" + jobId,
				exportUrl: prefix + "/export",
                modalName: "作业",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id',
					title : '唯一标识',
				},
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            actions.push('<a href="#" style="font-size: 18px" title="监控视图" onclick="runWatch(\'' + row.id + '\',\'' + jobId + '\')"><i class="fa fa-eye"></i></a>');
                            return actions.join('');
                        }
                    },
				{
					field : 'appName',
					title : '任务名称',
				},
				{
					field : 'startTime',
					title : '开始时间',
					sortable: true
				},
				{
					field : 'endTime',
					title : '结束时间',
					sortable: true
				},
                    {
                        field : 'durSecondTime',
                        title : '运行时长(秒)',
                        sortable: true
                    },
                    {
                        field : 'nominalTime',
                        title : '数据日期',
                        sortable: true
                    },
                    {
                        field : 'status',
                        title : '运行状态',
                        sortable: true
                    }
				]
            };
            $.table.init(options);

        });


        function runWatch(workflowId,jobId){
            var index = layer.open({
                type: 2,
                area: ['1400px', '700px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: workflowId,
                content: ctx + 'oozie/watchJob/runWatch?workflowId='+workflowId+"&jobId="+jobId,
                btn: ['关闭'],
                // 弹层外区域关闭
                shadeClose: true,
                cancel: function(index) {
                    return true;
                }
            });
            layer.full(index);
		}


    </script>
</body>
</html>